package com.young.common.core.event;

import com.young.interfaces.common.event.model.EventMessage;
import com.young.interfaces.common.event.model.IEvent;
import com.young.interfaces.common.event.model.IEventPublisher;

/**
 * 事件助手
 *
 * @author wangjy
 * @date 2021/10/30 10:42:52
 */
public class EventHelper {

    /**
     * 发布事件
     *
     * @param event
     * @param publisher
     * @param data
     */
    public static void publish(IEvent event, IEventPublisher publisher, Object data) {
        // 构造事件消息
        EventMessage message = EventMessage.build(event, publisher, data);
        // 发布事件
        EventControlCenter.publish(message);
    }
}
